// components/page_tool/paging.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    page: {
      type: Number,
      value: 1
    },
    page_size: {
      type: Number,
      value: 1,
    },
    total: {
      type: Number,
      value: 0
    },
    page_all: {
      type: Number,
      value: 0
    },
    page_color:{
      type:String,
      value:''
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    page_show: false,

  },

  /**
   * 组件的方法列表
   */
  methods: {
    pageUp() {
      let now_page = this.data.page
      if (now_page != 1) {
        now_page = now_page - 1
        this.setData({
          page: now_page,
        })
      }
      this.triggerEvent('myevent', { sonParam: now_page })
      // console.log("aa",this.data.page);
    },
    pageDown() {
      let now_page = this.data.page
      if (now_page < this.data.page_all) {
        now_page = now_page + 1
        this.setData({
          page: now_page
        })
      }
      this.triggerEvent('myevent', { sonParam: now_page })
      // console.log("123",this.data.page);

    },
    pageSelect() {
      console.log(this.data.page_all);
      this.setData({
        page_show: true
      })

    },
    onPageClose() {
      console.log(this.data.page_all);
      this.setData({
        page_show: false
      })

    },
    checkMaxPage(e) {
      if (e.detail > this.data.page_all) {
        this.setData({
          page: 1
        })
      }
    },

    onPageConfirm() {
      let now_page = this.data.page
      this.triggerEvent('myevent', { sonParam: now_page })
    },

  }
})
